package com.annual.system.domain;

import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import com.baomidou.mybatisplus.annotation.TableName;
import javax.validation.constraints.*;
import com.fasterxml.jackson.annotation.JsonFormat;
/**
* <p>
* 订单表
* </p>
*
* @author ywb
* @since 2024-12-02
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("t_order")
@ApiModel(value="Order对象", description="订单表")
public class Order extends Model<Order> {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "主键id")
    @TableId(value = "order_id", type = IdType.AUTO)
    @NotNull(message="主键id不能为空")
    private Long orderId;

    @ApiModelProperty(value = "订单类型（1：用户支付订单 ，2：退款订单）")
    @NotNull(message="订单类型（1：用户支付订单 ，2：退款订单）为空")
    private Integer orderType;

    @ApiModelProperty(value = "用户id")
    @NotNull(message="用户id不能为空")
    private Long userId;

    @ApiModelProperty(value = "业务表id")
    @NotNull(message="业务表id不能为空")
    private Long enterpriseBusinessId;

    @ApiModelProperty(value = "价格(单价)")
    @NotNull(message="价格(单价)不能为空")
    private BigDecimal price;

    @ApiModelProperty(value = "订单金额（总金额）")
    @NotNull(message="订单金额（总金额）不能为空")
    private BigDecimal fee;

    @ApiModelProperty(value = "退款金额")
    private BigDecimal refundAmount;

    @ApiModelProperty(value = "业务类型（1：执照年报 2：执照注销 3：信用修复）")
    @NotNull(message="业务类型（1：执照年报 2：执照注销 3：信用修复）不能为空")
    private Integer type;

    @ApiModelProperty(value = "状态（1.待付款 2.已付款 3.已处理 4.已退款 5.已关闭）")
    @NotBlank(message="状态（1.待付款 2.已付款 3.已处理 4.已退款 5.已关闭）")
    private Integer status;

    @ApiModelProperty(value = "微信支付订单号")
    private String outTradeNo;

    @ApiModelProperty(value = "支付流水（第三方返回的交易号）")
    private String serialNo;

    @ApiModelProperty(value = "支付时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime payTime;

    @ApiModelProperty(value = "退款订单号")
    private String outRefundNo;
    @ApiModelProperty(value = "退款时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime refundTime;
    @ApiModelProperty(value = " 退款orderId")
    private Long refundOrderId;
    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @NotNull(message="创建时间不能为空")
    private LocalDateTime createTime;


    @Override
    protected Serializable pkVal() {
        return this.orderId;
    }

}
